#include "RTSPProcessControl.h"

UInt32 CRTSPProcessControl::m_RTSPMask[RTSPTotalStatus][2] =
{
	{1<<RTSPDescribe, 0x00000000},
    	{1<<RTSPSetup, 0x00000001},
    	{1<<RTSPPlay,0x00000003}
};

CRTSPProcessControl::CRTSPProcessControl()
{
	m_Status = 0;
}


CRTSPProcessControl::~CRTSPProcessControl()
{
}

Bool CRTSPProcessControl::IsValidStatus( UInt32 vStatus )
{
	if(vStatus >= RTSPTotalStatus) return TRUE;
	UInt32 iMask = m_RTSPMask[vStatus][1];
	if((m_Status &  iMask) != iMask) return FALSE;
	return TRUE;
}

Bool CRTSPProcessControl::AddStatus( UInt32 vStatus )
{
	if(!IsValidStatus(vStatus)) return FALSE;
	m_Status |= m_RTSPMask[vStatus][0];
	return TRUE;
}

Bool CRTSPProcessControl::DeleteStatus( UInt32 vStatus )
{
	if(vStatus >= RTSPTotalStatus) return TRUE;
	m_Status &= ~m_RTSPMask[vStatus][0];
	return TRUE;
}

Bool CRTSPProcessControl::Clear( )
{
	m_Status = 0;
	return TRUE;
}

UInt32 CRTSPProcessControl::GetStatus( )
{
	return m_Status;
}

